package com.dotstone.chipism.activity;

import com.dotstone.chipism.R;
import com.dotstone.chipism.view.slidingfragmenu.BarUtils;

import android.content.Context;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

public class RemoteSatelliteActivity extends BaseActivity {
	private LinearLayout mBackL;
	private TextView mStatusBar;
	private Button mPowerB;
	private TextView mTitleTv;
	private boolean power = false;
	private Button mVoiceB;
	private Button mSettingB;
	private Button mHomeB;
	private Button mMenuB;
	private Button mUpB;
	private Button mDownB;
	private Button mLeftB;
	private Button mRightB;
	private Button mSounddownB;
	private Button mSoundupB;
	private Button mOkB;
	private Button mReturnB;
	private Button mMoreB;

	@Override
	public void widgetClick(View v) {
		// TODO Auto-generated method stub
		switch (v.getId()) {
		case R.id.back_layout:
			finish();
			break;
		case R.id.power_b:
			if(power){	//当前打开 发送关指令
				mPowerB.setBackgroundResource(R.drawable.kaiguan22x);
			}else{	//当前关闭 发送开的指令
				mPowerB.setBackgroundResource(R.drawable.kaiguan12x);
			}
			power = !power;
			break;
		case R.id.voice_btn:

			break;
		case R.id.setting_btn:

			break;
		case R.id.home_btn:

			break;
		case R.id.menu_btn:

			break;
		case R.id.up_btn:

			break;
		case R.id.down_btn:

			break;
		case R.id.left_btn:

			break;
		case R.id.right_btn:

			break;
		case R.id.sound_down_btn:

			break;
		case R.id.sound_up_btn:

			break;
		case R.id.ok_btn:

			break;
		case R.id.return_btn:

			break;
		case R.id.more_btn:

			break;

		default:
			break;
		}
	}

	@Override
	public void initParms(Bundle parms) {
		// TODO Auto-generated method stub

	}

	@Override
	public View bindView() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public int bindLayout() {
		// TODO Auto-generated method stub
		return R.layout.activity_satellite;
	}

	@Override
	public void initView(View view) {
		// TODO Auto-generated method stub
		mBackL = $(R.id.back_layout);
		mStatusBar = $(R.id.tv_statusBar_mian);
		mTitleTv = $(R.id.title_tv);
		mTitleTv.setText("机顶盒");
		boolVersion();
		mPowerB = $(R.id.power_b);
		mVoiceB = $(R.id.voice_btn);
		mSettingB = $(R.id.setting_btn);
		mHomeB = $(R.id.home_btn);
		mMenuB = $(R.id.menu_btn);
		mUpB = $(R.id.up_btn);
		mDownB = $(R.id.down_btn);
		mLeftB = $(R.id.left_btn);
		mRightB = $(R.id.right_btn);
		mSounddownB = $(R.id.sound_down_btn);
		mSoundupB = $(R.id.sound_up_btn);
		mOkB = $(R.id.ok_btn);
		mReturnB = $(R.id.return_btn);
		mMoreB = $(R.id.mode_btn);

		mBackL.setOnClickListener(this);
		mPowerB.setOnClickListener(this);
		mVoiceB.setOnClickListener(this);
		mSettingB.setOnClickListener(this);
		mHomeB.setOnClickListener(this);
		mMenuB.setOnClickListener(this);
		mUpB.setOnClickListener(this);
		mDownB.setOnClickListener(this);
		mLeftB.setOnClickListener(this);
		mRightB.setOnClickListener(this);
		mSounddownB.setOnClickListener(this);
		mSoundupB.setOnClickListener(this);
		mOkB.setOnClickListener(this);
		mReturnB.setOnClickListener(this);
		mMoreB.setOnClickListener(this);
	}

	@Override
	public void setListener() {
		// TODO Auto-generated method stub

	}

	@Override
	public void doBusiness(Context mContext) {
		// TODO Auto-generated method stub

	}

	public void boolVersion() {
		if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {

			Window window = getWindow();
			window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,
					WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
			// 透明导航栏
//			getWindow().addFlags(
//					WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
			// 改变titlebar的高度
			int statusbarHeight = BarUtils.getStatusBarHeight(this);
			RelativeLayout.LayoutParams layoutParams1 = (RelativeLayout.LayoutParams) mStatusBar
					.getLayoutParams();
			layoutParams1.height = statusbarHeight;
			mStatusBar.setLayoutParams(layoutParams1);
			mStatusBar.setVisibility(View.VISIBLE);
		} else {
			mStatusBar.setVisibility(View.GONE);
		}
	}

}
